package fr.umlv.m2.jee.pmlv.service.planning.impl;

import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import fr.umlv.m2.jee.pmlv.persistence.planning.EventProject;
import fr.umlv.m2.jee.pmlv.persistence.planning.dao.IEventProjectDAO;
import fr.umlv.m2.jee.pmlv.service.planning.DisplayAbstractEvent;
import fr.umlv.m2.jee.pmlv.service.planning.IDisplayEventProjectService;

@Service("defautDisplayEventProjectService")
public class DefautDisplayEventProjectService implements IDisplayEventProjectService{
	
	@Autowired
	@Qualifier("hibernateEventProjectDAO")
	private IEventProjectDAO dao;
	
	@Override
        @Transactional(readOnly=true)
	public List<DisplayAbstractEvent> getProjectByWeekAndByProfessorUid(GregorianCalendar start, String uid) {
            ArrayList< DisplayAbstractEvent > result = new ArrayList< DisplayAbstractEvent >(16);
            /* for(EventProject eventProject : dao.findByWeek(start) ) {
            result.add(new DisplayEventExam(eventProject));

            }*/
            return result;
	}

	@Override
        @Transactional
	public void addEvent(EventProject eventProject) {
		dao.merge(eventProject);
	}
}
